package com.code.translate.function;

import java.util.Map;

/**
 * @author ggh
 * @date 2022/7/17
 * 文本翻译
 */
public abstract class TextTranslatePlugin {

    public String translate(String text) throws Exception {
        Map<String, Object> params = this.prepare();
        return this.doTranslate(text, params);
    }

    protected abstract Map<String, Object> prepare() throws Exception;

    protected abstract String doTranslate(String text, Map<String, Object> params) throws Exception;

    protected String doExtract(String response) {
        return null;
    }
}
